const {resolve} = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')


module.exports = {
     entry:"./src/js/index.js",
    output:{
        // [name] 入口文件名
        filename:"js/[name].[contenthash:10].js",
        path:resolve(__dirname,"build")
    },
    plugins:[ 
        //编译html
        new HtmlWebpackPlugin({
            filename:"index.html",
            template:"./src/index.html",
            minify:{
                collapseWhitespace:true,
                removeComments:true
            }
        })

    ],
    mode:"production", 
    //externals 配置选项提供了「从输出的 bundle 中排除依赖」的方法
    externals:{
        jQuery :"jQuery"
    }
}